package com.brave.utils;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class AliOSSConfig
{
    //不需动态设置
    public static final String ALI_OSS_BUCKET_NAME = "has-free-bucket";
    @Value("${aliyun.oss.access.key}")
    private String accessKey;
    @Value("${aliyun.oss.access.secret}")
    private String accessSecret;
    @Value("${aliyun.oss.access.endpoint}")
    private String endpoint;
    
    @Bean
    public OSS ossClientBuilder()
    {
        OSS ossClient = new OSSClientBuilder().build(endpoint, accessKey, accessSecret);
        return ossClient;
    }
}